/* GUI CONVERTED from rsrp03.p (converter v1.75) Tue Nov  7 07:30:13 2000 */
/* rsrp03.p - Release Management Supplier Schedules                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Report                                        */
/* REVISION: 7.0    LAST MODIFIED: 01/29/92   BY: WUG *F110*            */
/* REVISION: 7.0    LAST MODIFIED: 03/19/92   BY: WUG *F312*            */
/* REVISION: 7.0    LAST MODIFIED: 03/26/92   BY: WUG *F323*            */
/* Revision: 7.3    LAST MODIFIED: 11/19/9    BY: jcd *G348*            */
/* REVISION: 7.3    LAST MODIFIED: 12/10/92   BY: WUG *G462*            */
/* REVISION: 7.3    LAST MODIFIED: 01/12/95   BY: srk *G0C1*            */
/* REVISION: 7.3    LAST MODIFIED: 04/21/97   BY: *G2MD* Aruna Patil    */
/* REVISION: 8.6    LAST MODIFIED: 10/10/97   BY: GYK *K0MS*            */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane      */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan     */
/* REVISION: 9.0    LAST MODIFIED: 12/01/98   BY: *K1QY* Pat McCormick  */
/* REVISION: 9.0    LAST MODIFIED: 02/06/99   BY: *M06R* Doug Norton    */
/* REVISION: 9.0    LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan     */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* REVISION: 9.1    LAST MODIFIED: 09/11/00   BY: *N0RT* Mudit Mehta      */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

         {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rsrp03_p_2 "Created"
/* MaxLen: Comment: */

/*N0RT***********BEGIN COMMENTING*************
 * &SCOPED-DEFINE rsrp03_p_1 "2 - By Item, Ship-to, Supplier, PO"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rsrp03_p_3 "3 - By PO, Item"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rsrp03_p_4 "1 - By Ship-to, Supplier, Item, PO"
 * /* MaxLen: Comment: */
 *N0RT***********END COMMENTING************* */

&SCOPED-DEFINE rsrp03_p_5 "Sort Option"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */


/* SCHEDULE AUTHORIZATION REPORT */
/*K0MS*/ define new shared variable supplier_from like po_vend.
/*K0MS*/ define new shared variable supplier_to like po_vend.
/*K0MS*/ define new shared variable shipto_from like po_ship.
/*K0MS*/ define new shared variable shipto_to like po_ship.
/*K0MS*/ define new shared variable part_from like pod_part.
/*K0MS*/ define new shared variable part_to like pod_part.
/*K0MS*/ define new shared variable po_from like po_nbr.
/*K0MS*/ define new shared variable po_to like po_nbr.
/*K0MS*/ define new shared variable buyer_from like po_buyer.
/*K0MS*/ define new shared variable buyer_to like po_buyer.
/*K0MS*/ define new shared variable date_from as date label {&rsrp03_p_2}.
/*K0MS*/ define new shared variable date_to as date.
/*K0MS*/ define new shared variable sortoption as integer
                                    label {&rsrp03_p_5} format "9" initial 1.
/*N0RT*
 * /*K0MS*/ define new shared variable sortextoption as character
 *                                                      extent 3 format "x(34)"
 *   init [
 *   {&rsrp03_p_4},
 *   {&rsrp03_p_1},
 *   {&rsrp03_p_3}].
 *N0RT*/
/*N0RT*/ define new shared variable sortextoption as character
                                                      extent 3 format "x(34)".
/*K0MS*/ define variable hiraw_rlse_id like sch_rlse_id.
/*K0MS*/ define variable hiraw_qty like sch_raw_qty.
/*K0MS*/ define variable hiraw_strt like sch_raw_strt.
/*K0MS*/ define variable hiraw_end like sch_raw_end.

/*K0MS*/ define variable hifab_rlse_id like sch_rlse_id.
/*K0MS*/ define variable hifab_qty like sch_fab_qty.
/*K0MS*/ define variable hifab_strt like sch_fab_strt.
/*K0MS*/ define variable hifab_end like sch_fab_end.
/*K1QY*/ define variable schtype like sch_type initial 4.
/*K1QY*/ define variable sch_type_desc as character format "x(24)" no-undo.
/*K1QY*/ define variable sch_type_numonic as character format "x(8)" no-undo.


/*N0RT************* SET INITIAL VALUSES ************* */
/*N0RT*/ sortextoption[1] = "1 - " + getTermLabel("BY",2) + " " +
                             getTermLabel("SHIP-TO",7) + ", " +
                             getTermLabel("SUPPLIER",8) + ", " +
                             getTermLabel("ITEM",4) + ", " +
                             getTermLabel("PURCHASE_ORDER",2).
/*N0RT*/ sortextoption[2] = "2 - " + getTermLabel("BY",2) + " " +
                             getTermLabel("ITEM",4) + ", " +
                             getTermLabel("SHIP-TO",7) + ", " +
                             getTermLabel("SUPPLIER",8) + ", " +
                             getTermLabel("PURCHASE_ORDER",2).
/*N0RT*/ sortextoption[3] = "3 - " + getTermLabel("BY",2) + " " +
                             getTermLabel("PURCHASE_ORDER",2) + ", " +
                             getTermLabel("ITEM",4).
         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
po_from              colon 20
            po_to                colon 50 label {t001.i}
            part_from            colon 20
            part_to              colon 50 label {t001.i}
            supplier_from        colon 20
            supplier_to          colon 50 label {t001.i}
            shipto_from          colon 20
            shipto_to            colon 50 label {t001.i}
            buyer_from           colon 20
            buyer_to             colon 50 label {t001.i}
            date_from            colon 20
            date_to              colon 50 label {t001.i}
            skip(1)
/*K1QY*/    schtype              colon 20
/*K1QY*/    space (3)
            sch_type_desc              no-label
            sortoption           colon 20
            sortextoption[1]     at 30 no-label
            sortextoption[2]     at 30 no-label
            sortextoption[3]     at 30 no-label
            skip(1)
         with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

/*G0C1*  repeat with frame a: */

/*K0MS*/ {wbrp01.i}

/*G0C1*/ repeat:

/*K0MS*     disp sortextoption */
/*K0MS*/    display sortextoption
/*G0C1*/    with frame a.

            if po_to = hi_char then po_to = "".
            if part_to = hi_char then part_to = "".
            if supplier_to = hi_char then supplier_to = "".
            if shipto_to = hi_char then shipto_to = "".
            if buyer_to = hi_char then buyer_to = "".

/*G2MD*     if date_from = 01/01/1960 then date_from = ?. */
/*G2MD*     if date_to = 12/31/2100 then date_to = ?.     */

/*G2MD*/    if date_from = low_date then date_from = ?.
/*G2MD*/    if date_to = hi_date then date_to = ?.

/*K1QY*/    /* CHECK FLAG TO SEE IF MODULE IS TURNED ON */
/*K1QY*/    if can-find (first mfc_ctrl where
/*K1QY*/       mfc_field = "enable_shipping_schedules"
/*K1QY*/       and mfc_seq = 4 and mfc_module = "ADG"
/*K1QY*/       and mfc_logical = yes)
/*K1QY*/       then do:
/*K1QY*/                schtype = 5.
/*K1QY*/       end. /* do */
/*K1QY*/     {gplngn2a.i
              &file     = ""sch_mstr""
              &field    = ""sch_type""
              &code     = string(schtype)
              &mnemonic = sch_type_numonic
              &label    = sch_type_desc}
/*K1QY*/      if not available lngd_det then
/*K1QY*/        {mfmsg.i 4211 3} /* Invalid Type */
/*K1QY*/      else
/*K1QY*/        display sch_type_desc
/*K1QY*/                schtype with frame a.
/*K0MS*/    if c-application-mode <> 'web':u then
            update
               po_from
               po_to
               part_from
               part_to
               supplier_from
               supplier_to
               shipto_from
               shipto_to
               buyer_from
               buyer_to
               date_from
               date_to
               sortoption
/*G0C1*/    with frame a.

/*K0MS*/    {wbrp06.i &command = update
                      &fields = "  po_from po_to part_from part_to
                       supplier_from supplier_to shipto_from shipto_to
                       buyer_from buyer_to date_from date_to sortoption "
                      &frm = "a"}

/*K1QY**
 * /*K0MS*/ if (c-application-mode <> 'web':u) or
 * /*K0MS*/ (c-application-mode = 'web':u and
 * /*K0MS*/ (c-web-request begins 'data':u)) then do:
 *K1QY**/

/*K1QY*/    if (c-application-mode <> 'WEB') or
/*K1QY*/       (c-application-mode = 'WEB' and
/*K1QY*/       (c-web-request begins 'DATA'))
            then do:

               bcdparm = "".

               {mfquoter.i po_from     }
               {mfquoter.i po_to       }
               {mfquoter.i part_from   }
               {mfquoter.i part_to     }
               {mfquoter.i supplier_from}
               {mfquoter.i supplier_to }
               {mfquoter.i shipto_from }
               {mfquoter.i shipto_to   }
               {mfquoter.i buyer_from  }
               {mfquoter.i buyer_to    }
               {mfquoter.i date_from   }
               {mfquoter.i date_to     }
               {mfquoter.i sortoption  }

               if po_to = "" then po_to = hi_char.
               if part_to = "" then part_to = hi_char.
               if supplier_to = "" then supplier_to = hi_char.
               if shipto_to = "" then shipto_to = hi_char.
               if buyer_to = "" then buyer_to = hi_char.

/*G2MD*        if date_from = ? then date_from = 01/01/1960. */
/*G2MD*        if date_to = ? then date_to = 12/31/2100.     */

/*G2MD*/       if date_from = ? then date_from = low_date.
/*G2MD*/       if date_to = ? then date_to = hi_date.

/*K0MS*/    end.

            /* SELECT PRINTER */
            {mfselbpr.i "printer" 132}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.

            {mfphead2.i}

/*K1QY*/    run run_report_procedure.

            /* REPORT TRAILER */
            {mfrtrail.i}

         end.

/*K0MS*/ {wbrp04.i &frame-spec = a}

/*K1QY*/ PROCEDURE run_report_procedure:

         if sortoption = 1 then do:
            for each scx_ref no-lock
            where scx_type = 2
            and scx_shipfrom >= supplier_from and scx_shipfrom <= supplier_to
            and scx_shipto >= shipto_from and scx_shipto <= shipto_to
            and scx_part >= part_from and scx_part <= part_to
            and scx_po >= po_from and scx_po <= po_to,
            each pod_det no-lock
            where pod_nbr = scx_order and pod_line = scx_line,
            each po_mstr no-lock
            where po_nbr = pod_nbr
            and po_buyer >= buyer_from and po_buyer <= buyer_to,
            each sch_mstr no-lock
/*K1QY*     where sch_type = 4 */
/*K1QY*/    where sch_type = schtype
            and sch_nbr = pod_nbr
            and sch_line = pod_line
            and sch_cr_date >= date_from and sch_cr_date <= date_to
            break by scx_shipto by scx_shipfrom by scx_part by scx_po
/*N0RT*     by sch_nbr by sch_line by sch_rlse_id: */
/*N0RT*/    by sch_nbr by sch_line by sch_rlse_id with frame f-a:
               /* SET EXTERNAL LABELS */
/*N0RT*/       setFrameLabels(frame f-a:handle).
/*G348*/       
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

               {rsrp03.i}
            end.
         end.

         else
         if sortoption = 2 then do:
            for each scx_ref no-lock
            where scx_type = 2
            and scx_shipfrom >= supplier_from and scx_shipfrom <= supplier_to
            and scx_shipto >= shipto_from and scx_shipto <= shipto_to
            and scx_part >= part_from and scx_part <= part_to
            and scx_po >= po_from and scx_po <= po_to,
            each pod_det no-lock
            where pod_nbr = scx_order and pod_line = scx_line,
            each po_mstr no-lock
            where po_nbr = pod_nbr
            and po_buyer >= buyer_from and po_buyer <= buyer_to,
            each sch_mstr no-lock
/*K1QY*     where sch_type = 4  */
/*K1QY*/    where sch_type = schtype
            and sch_nbr = pod_nbr
            and sch_line = pod_line
            and sch_cr_date >= date_from and sch_cr_date <= date_to
            break by scx_part by scx_shipto by scx_shipfrom by scx_po
/*N0RT*     by sch_nbr by sch_line by sch_rlse_id: */
/*N0RT*/    by sch_nbr by sch_line by sch_rlse_id with frame f-b:
               /* SET EXTERNAL LABELS */
/*N0RT*/       setFrameLabels(frame f-b:handle).
/*G348*/       
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

               {rsrp03.i}
            end.
         end.

         else
         if sortoption = 3 then do:
            for each scx_ref no-lock
            where scx_type = 2
            and scx_shipfrom >= supplier_from and scx_shipfrom <= supplier_to
            and scx_shipto >= shipto_from and scx_shipto <= shipto_to
            and scx_part >= part_from and scx_part <= part_to
            and scx_po >= po_from and scx_po <= po_to,
            each pod_det no-lock
            where pod_nbr = scx_order and pod_line = scx_line,
            each po_mstr no-lock
            where po_nbr = pod_nbr
            and po_buyer >= buyer_from and po_buyer <= buyer_to,
            each sch_mstr no-lock
/*K1QY*     where sch_type = 4  */
/*K1QY*/    where sch_type = schtype
            and sch_nbr = pod_nbr
            and sch_line = pod_line
            and sch_cr_date >= date_from and sch_cr_date <= date_to
            break by scx_po by scx_part
/*N0RT*     by sch_nbr by sch_line by sch_rlse_id: */
/*N0RT*/    by sch_nbr by sch_line by sch_rlse_id with frame f-c:
               /* SET EXTERNAL LABELS */
/*N0RT*/       setFrameLabels(frame f-c:handle).
               
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/
                     /*G348*/
               {rsrp03.i}
            end.
         end.

/*K1QY*/ END PROCEDURE. /* procedure */
